<?php
class basicNetwork_teached extends model
{
    
    const ValidRule_id_network_teached_isInt = 'ValidRule-id_network_teached-isInt';
    const ValidRule_id_network_teached_exists = 'ValidRule-id_network_teached-exists';
    const ValidRule_id_network_prepared_isInt = 'ValidRule-id_network_prepared-isInt';
    const ValidRule_id_network_prepared_exists = 'ValidRule-id_network_prepared-exists';
    const ValidRule_id_training_file_isInt = 'ValidRule-id_training_file-isInt';
    const ValidRule_id_training_file_exists = 'ValidRule-id_training_file-exists';
    const ValidRule_file_exists = 'ValidRule-file-exists';

	
    public $id_network_teached;
    public $id_network_prepared;
    public $id_training_file;
    public $file;
    public $name;
    public $momentum;
    public $rate;
    public $epoc;
    public $desired_error;
    public $bit_fail;


	public static function loadModel($id=null, $join=null)
	{
		$obiekt = new Network_teached($id, $join);
		if(!$obiekt ->isNull())
			return $obiekt;
		else return null;
	}
				
	public static function loadSpecialModel($where){
		$stmt = self::$pdo -> query("SELECT * FROM Network_teached WHERE $where LIMIT 1;");
		$row = $stmt -> fetch(PDO::FETCH_ASSOC);
		if(!$row)
			return self::loadModel();
		$model = self::loadModel();
		$model -> SetValues($row);
		$model -> NewRecord = false;
		return $model;
	}

	public static function getAll($where=null)
	{
		return model::getAll('Network_teached', $where);
	}

	public function __construct($id=null, $join = null)
	{
		parent::__construct($id, $join);
		$this -> labels = array(
            'id_network_teached' => 'id_network_teached', 
            'id_network_prepared' => 'id_network_prepared', 
            'id_training_file' => 'id_training_file', 
            'file' => 'file',
            'name' => 'Nazwa',
            'rate' => 'Współczynnik nauki',
            'momentum' => 'Momentum',
            'epoc' => 'Liczba epok',
            'desired_error' => 'Oczekiwany błąd',
             'bit_fail'    => 'Bit fail'
        );
	}

		
	public function getTableName()
	{
		return 'Network_teached';
	}

	public function getPrimaryKey()
	{
		return 'id_network_teached';
	}

	public function getColumns()
	{
		return array('id_network_teached', 'id_network_prepared', 'id_training_file', 'file', 'name', 'momentum', 'rate', 'epoc', 'desired_error', 'bit_fail');
	}

	protected function getBoolColumns()
	{
		return array();
	}

	public function getRules($ignore=array())
	{
		$rules = array(
            'ValidRule-id_network_teached-isInt' => new ValidRule('id_network_teached', isInt, array(&$this->id_network_teached)),
            'ValidRule-id_network_teached-exists' => new ValidRule('id_network_teached', exists, array(&$this->id_network_teached)),
            'ValidRule-id_network_prepared-isInt' => new ValidRule('id_network_prepared', isInt, array(&$this->id_network_prepared)),
            'ValidRule-id_network_prepared-exists' => new ValidRule('id_network_prepared', exists, array(&$this->id_network_prepared)),
            'ValidRule-id_training_file-isInt' => new ValidRule('id_training_file', isInt, array(&$this->id_training_file)),
            'ValidRule-id_training_file-exists' => new ValidRule('id_training_file', exists, array(&$this->id_training_file)),
            'ValidRule-file-exists' => new ValidRule('file', exists, array(&$this->file))	
        );			

		if(!empty($ignore))
		{
			if(!is_array($ignore)) $ignore = array($ignore);
			foreach($ignore as $field)
			{
				unset($rules[$field]);
			}
		}
		return $rules;

	}

    protected function getJoinTables() {
        return array('network_prepared', 'training_data');
    }


}
?>